<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>全局自定义模板</title>
</head>
<body>
<!--css配置-->
<style>
</style>
<!--是否加载全局模板 请填写正确的load-template 格式：http://www.xxx.com/-->
<section id="rootTemplate" load-template=""></section>
<!--配置API地址 可以覆盖root配置 api-url格式：http://www.xxx.com/-->
<section id="controller" api-url=""></section>
<!--RootToolbar配置-->
<section id="toolbar">
</section>
<!--Template配置 key是唯一标识，请不要修改已保证页面正常运行-->
<section type="template" id="template">
<a-row>
    <a-col>
        <a-title key="2031551683664047" data-name="会议通知流程"></a-title>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-create-by key="creater" data-name="创建人"></a-create-by>
    </a-col>
    <a-col>
        <a-created-time key="createdTime" data-name="创建时间"></a-created-time>
    </a-col>
    <a-col>
        <a-sequence-no key="sequenceNo" data-name="单据号"></a-sequence-no>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-group-title key="2001551683664048" data-name="会议通知内容"></a-group-title>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-text key="subject" data-name="标题" data-default-value="会议通知单"></a-text>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-date key="mettingTime" data-name="会议开始时间" data-format="YYYY-MM-DD HH:mm"></a-date>
    </a-col>
    <a-col>
        <a-date key="meetingEndtime" data-name="会议结束时间" data-format="YYYY-MM-DD HH:mm"></a-date>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-user-selector key="signer" data-name="签发人"></a-user-selector>
    </a-col>
    <a-col>
        <a-user-selector key="signDepartment" data-name="签发部门" data-dept-visible="org"></a-user-selector>
    </a-col>
    <a-col>
        <a-date key="signTime" data-name="签发时间"></a-date>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-association-form key="meetingAddress" data-name="会议地点" data-schema-code="MEETING_ROOM"></a-association-form>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-textarea key="meetingContent" data-name="会议内容" data-max-length="200"></a-textarea>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-attachment key="meetingFile" data-name="会议文件"></a-attachment>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-logic key="hasUserList" data-name="指定参会名单" data-on-change='this.meetingClerk.value="";
this.meetingClerkState.value=0;
this.meetingClerkDetail.value="";
this.meetingDepartment.value="";
this.meetingDepartmentRef.value=[];
this.meetingParticipant.value="";
this.meetingParticipantDetail.value=[];'></a-logic>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-association-form key="meetingClerk" data-name="会议拟办员" data-display-formula="{hasUserList} == false" data-query-code="department_planning_clerk" data-schema-code="department_planning_clerk" data-mappings="department_planning_clerk:{meetingClerkDetail}"></a-association-form>
    </a-col>
    <a-col>
        <a-user-selector key="meetingClerkDetail" data-name="拟办员明细" data-on-change='if(value==""){
 this.meetingClerkState.value = -1;
}else{
 this.meetingClerkState.value = 1;
}

' data-display-formula="{hasUserList} == false" data-multi="true"></a-user-selector>
    </a-col>
    <a-col>
        <a-number key="meetingClerkState" data-name="会议拟办人员状态" data-display-formula="{hasUserList} == false" data-default-value="0"></a-number>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-association-form key="meetingDepartment" data-name="部门组" data-display-formula="{hasUserList} == true" data-query-code="department_group" data-schema-code="department_group" data-mappings="department_lists:{meetingDepartmentRef}"></a-association-form>
    </a-col>
    <a-col>
        <a-user-selector key="meetingDepartmentRef" data-name="部门明细" data-display-formula="{hasUserList} == true" data-multi="true" data-dept-visible="org"></a-user-selector>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-association-form key="meetingParticipant" data-name="人员组" data-display-formula="{hasUserList} == true" data-query-code="commonly_used_user_group" data-schema-code="commonly_used_user_group" data-mappings="user_group_member:{meetingParticipantDetail}"></a-association-form>
    </a-col>
    <a-col>
        <a-user-selector key="meetingParticipantDetail" data-name="人员组明细" data-display-formula="{hasUserList} == true" data-multi="true"></a-user-selector>
    </a-col>
</a-row>
<a-row>
    <a-col>
        <a-comment key="ApprovalOpinion1552534404694" data-name="审批意见"></a-comment>
    </a-col>
</a-row>
</section>
<!--自定义事件配置-->
<script id="customScript">
    (function(form){
        /**
         * 用户自定义JS区域
         */
        /**
         * 事件绑定，form.on
         * @param eventType 事件类型
         * @params function 事件
         * @param  cover    true, false 是否覆盖root的生命周期 默认不覆盖 
         */
        //数据加载后，渲染之前
        form.on('onLoad',function(data){

        },'cover');
        //内置校验完成后，返回false阻止提交
        form.on('onValidate',function(action,data){});
        //操作前执行，返回false阻止按钮操作
        form.on('onPreAction',function(action,data){
            
            if (action.code === 'submit') {
                var _this = this;
                const params = {
                    schemaCode: 'meeting_notice',
                    meetingId: data.meetingAddress,
                    mettingTime: data.mettingTime,
                    meetingEndtime: data.meetingEndtime
                }
                return axios.post("/api/meeting/check", params).then(function(res) {
                    if (res.errcode === 0) {
                    } else if (res.errcode = 800001) {
                        _this.$message.warning('会议室该时间段已经被占用!');
                        return false;
                    } else if (res.errcode = 800002) {
                        _this.$message.warning('会议开始时间不能早于会议结束时间!');
                        return false;
                    } else if(res.errcode = 800003) {
                        _this.$message.warning('会议开始时间不能早于当前时间!');
                        return false;
                    }
                     else {
                        _this.$message.warning(res.errmsg);
                        return false;
                    }
                });
            }
        });
        //操作后执行
        form.on('onActionDone',function(action,data){});
    })
</script>
<script src="/admin/js/chunk-vendors.js" class="templateScript"></script>
<script src="/admin/js/template.js" class="templateScript"></script>
</body>
</html>